package com.proxy.cglibProxy;

public class TestCglib {
    public static void main(String[] args) {
        TeacherDao target = new TeacherDao();
        //获取代理对象
        CglibProxyFactory factory =new CglibProxyFactory(target);
        TeacherDao proxyInstance =(TeacherDao) factory.getProxyInstance();

        //调用目标对象的方法
        proxyInstance.teach();
        String name = proxyInstance.checkName("小亮");
        System.out.println(name);

        //TeacherDao$$EnhancerByCGLIB$$eb8e2b0c 有$说明是代理类
        System.out.println(proxyInstance.getClass());
    }
}
